<?php
class NoBusinessBase_Helper_Xsl extends Zend_Controller_Action_Helper_Abstract
{

   public function direct()
   {
      return $this;
   }

   public function outputFromTemplateAndXmlText(Application_Model_XslTemplate $xslTemplate, $xmlText)
   {
      $xml = new DomDocument;
      $xsl = new DomDocument;

      $xml->loadXML($xmlText);
      $xsl->loadXML($xslTemplate->getValue());

      $xsltProc = new XsltProcessor();
      $xsltProc->importStyleSheet($xsl);

      // Start the transformation
      try
      {
         $output = $xsltProc->transformToXML($xml);
         return $output;
      }
      catch(Exception $e)
      {
         return $e;
      }
   }

}

